package com.csii.adhoc.dataunits;

import com.csii.adhoc.dataready.TDataCondPo;
import com.csii.adhoc.dataready.TDataCondVo;
import com.github.pagehelper.PageInfo;

import java.util.List;
import java.util.Map;

/*
  数据接口返回类
  并设置默认值
 */
public class UnitRespone {

    private Body body;

    private String token;

    // 操作是否成功 true/false
    private boolean success = true;
    // 返回类型,表示前端请求的“图表类型”用于前端处理时判断，默认为“分组表”
    private int type = 1;
    //返回码
    private String code = "200";
    //返回消息
    private String message = "";
    //错误码
    private String errorCode = "";
    // 错误消息
    private String errorMsg = "";
    //详细错误消息
    private String detailErrorMsg = "";
    // 是否有分页,有些查询不需要分页，前端先判断是否有分页，如有，再遍历分页
    private boolean bePagination = false;
    // 数据信息，各类型的"前端图形组件"要求返回的数据类型不一样，这里设置为通用型

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getDetailErrorMsg() {
        return detailErrorMsg;
    }

    public void setDetailErrorMsg(String detailErrorMsg) {
        this.detailErrorMsg = detailErrorMsg;
    }

    public boolean isBePagination() {
        return bePagination;
    }

    public void setBePagination(boolean bePagination) {
        this.bePagination = bePagination;
    }

    public class Body {

        private String modelId;
        private String tableId;
        private PageInfo page;
        private List<Map<String, String>> fields;
        private List data;
        // 条件组
        private List<TDataCondVo> condition;

        // 已选维度,当输入选择只有：维度和度量时，这里表示维度，当输入选择有：行维度和列维度、度量时，这里表示行维度
        private List<TextSelected> textFields1;

        // 已选列维度
        private List<TextSelected> textFields2;

        // 已选指标
        private List<NumberSelected> numberFields;

        // 已选分组
        private String selectedGroup;

        // 组件级图形属性
        private String widgets;

        // 组件 themes // 样式组
        private String themes = "";

        public String getModelId() {
            return modelId;
        }

        public void setModelId(String modelId) {
            this.modelId = modelId;
        }

        public String getTableId() {
            return tableId;
        }

        public void setTableId(String tableId) {
            this.tableId = tableId;
        }

        public PageInfo getPage() {
            return page;
        }

        public void setPage(PageInfo page) {
            this.page = page;
        }

        public List<Map<String, String>> getFields() {
            return fields;
        }

        public void setFields(List<Map<String, String>> fields) {
            this.fields = fields;
        }

        public List getData() {
            return data;
        }

        public void setData(List data) {
            this.data = data;
        }

        public List<TDataCondVo> getCondition() {
            return condition;
        }

        public void setCondition(List<TDataCondVo> condition) {
            this.condition = condition;
        }

        public List<TextSelected> getTextFields1() {
            return textFields1;
        }

        public void setTextFields1(List<TextSelected> textFields1) {
            this.textFields1 = textFields1;
        }

        public List<TextSelected> getTextFields2() {
            return textFields2;
        }

        public void setTextFields2(List<TextSelected> textFields2) {
            this.textFields2 = textFields2;
        }

        public List<NumberSelected> getNumberFields() {
            return numberFields;
        }

        public void setNumberFields(List<NumberSelected> numberFields) {
            this.numberFields = numberFields;
        }

        public String getSelectedGroup() {
            return selectedGroup;
        }

        public void setSelectedGroup(String selectedGroup) {
            this.selectedGroup = selectedGroup;
        }

        public String getWidgets() {
            return widgets;
        }

        public void setWidgets(String widgets) {
            this.widgets = widgets;
        }

        public String getThemes() {
            return themes;
        }

        public void setThemes(String themes) {
            this.themes = themes;
        }

        @Override
        public String toString() {
            return "Body{" +
                    "modelId='" + modelId + '\'' +
                    ", tableId='" + tableId + '\'' +
                    ", page=" + page +
                    ", fields=" + fields +
                    ", data=" + data +
                    ", condition=" + condition +
                    ", textFields1=" + textFields1 +
                    ", textFields2=" + textFields2 +
                    ", numberFields=" + numberFields +
                    ", selectedGroup='" + selectedGroup + '\'' +
                    ", widgets='" + widgets + '\'' +
                    ", themes='" + themes + '\'' +
                    '}';
        }
    }

    public Body getBody() {
        return body;
    }

    public void setBody(Body body) {
        this.body = body;
    }
}

